/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vue;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Polygon;

/**
 *
 * @author p1100274
 */
public class CaseTriangle extends Case {

    private boolean orientation;
    private int xBase;
    private int yBase;
    private int widthBase;
    private int heightBase;
    private int nbCaseX;
    private int nbCaseY;
    private Color c;

    CaseTriangle(boolean or, int nbX, int nbY) {
        super();
        setOpaque(false);
        orientation = or;
        nbCaseX = nbX;
        nbCaseY = nbY;
        c = Color.WHITE;

    }

    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);

        int[] pointX = new int[3];
        int[] pointY = new int[3];

        if (!orientation) {

            pointX[0] = this.getWidth() / 2;//xBase+widthBase/2;
            pointX[1] = this.getWidth();//xBase+widthBase;
            pointX[2] = 0;//xBase;
            pointY[0] = 0;//;yBase;
            pointY[1] = this.getHeight();//yBase+heightBase;
            pointY[2] = this.getHeight();//yBase+heightBase;
        } else {

            pointX[0] = 0;//xBase+widthBase/2;
            pointX[1] = this.getWidth();//xBase+widthBase;
            pointX[2] = this.getWidth() / 2;//xBase;
            pointY[0] = 0;//;yBase;
            pointY[1] = 0;//yBase+heightBase;
            pointY[2] = this.getHeight();

        }
        Polygon p = new Polygon(pointX, pointY, 3);
        
        g.setColor(c);

        g.fillPolygon(p);

        g.setColor(Color.LIGHT_GRAY);
        g.drawPolygon(p);

    }
    
    public void setColor(Color c2){
        c = c2;
        //System.out.println(c);
    }
    
    public Color getColor(){
        return c;
    }
    
    public int getNbX() {
        return nbCaseX;
    }

    public int getNbY() {
        return nbCaseY;
    }
}
